import Vue from 'vue'
import { mapState } from 'vuex'
import { mapGetters } from 'vuex'
import hello from './hello.vue'
import store from './store'

new Vue({
	el: '#msg',
	data: {
		message: 'Hello Vue'
	},
	components: {
		hello
	}
});



new Vue({
	el: '#app',
	store,
	// computed: {
	// 	count() {
	// 		return this.$store.state.count
	// 	}
	// },
	data: {
		showfinished: true
	},
	computed: {
		localcount() {
			return 100;
		},
		doneTodos() {
			if(this.showfinished) {
				return this.$store.getters.doneTodos;
			} else {
				return this.$store.getters.undoneTodos;
			}
		},
		// doneTodosCount() {
		// 	return this.$store.getters.doneTodosCount;
		// },
		...mapState([
		    'count'
		]),
		...mapGetters([
			'doneTodosCount'
		])
	},

	methods: {
		increment() {
			store.commit('increment');
		},
		decrement() {
			store.commit('decrement');
		},
		finished() {
			this.showfinished = true;
		},
		unfinished() {
			this.showfinished = false;
		}
	}
});

